package com.sie.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.sie.entity.EmpLogin;
import com.sie.entity.Login;
import com.sie.entity.ViewEmpLogin;
import org.apache.ibatis.annotations.*;

/**
 * 登录持久层
 */
@Mapper
public interface LoginMapper extends BaseMapper<EmpLogin> {

    @Select("SELECT * FROM view_emp_login WHERE login_name=#{username}")
    ViewEmpLogin login(@Param("username") String username);

    @Update("update login set login_password=#{password},login_salt=#{salt} where login_name=#{username}")
    int updatePassword(@Param("username") String username, @Param("password") String password, @Param("salt") String salt);

    int addLogin(Login login);

    @Delete("delete from login where login_id=#{id}")
    int delete(String id);

    @Select("select * from login where login_name=#{name}")
    Login findGetName(String name);


}
